﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Hongapo_Common;
using System.Text;

public partial class index : Hongapo_Services.UIPage
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            LoadContent();
        }
    }

    #region 加载资讯内容
    /// <summary>
    /// 加载资讯内容
    /// </summary>
    private void LoadContent()
    {
        StringBuilder str = new StringBuilder();
        string path = "images/product/";
        Hongapo_Services.Product.Product pro = new Hongapo_Services.Product.Product();
        DataSet ds = pro.GetList(20,1," isopen=1 ");
        DataTable dt = ds.Tables[0];
        foreach (DataRow dr in dt.Rows)
        {

            DataTable dt_mall = new Hongapo_Services.Mall.Mall().GetList(" ID="+dr["MID"]+"").Tables[0];
            DataTable dt_img = new Hongapo_Services.Product.ProductImage().GetList(" OrderNo='"+dr["OrderNo"]+"' and isopen=1").Tables[0];
            str.Append(" <div class=\"info\"  ><div class=\"news_qtlg\"><div class=\"lf_indtype\">");
            str.Append("<h2><a href=\"goods.aspx?id=" + dr["ID"] + "\" target=\"_blank\">" + dr["Title"] + "</a></h2>");
            str.Append(" <p class=\"dat_fb\">" + dr["AuditName"] + " 发布于 " + dr["Createdate"] +
                " | " + dr["clicks"] + " 次阅读 | " + dr["commentCount"] + " 次评论 |<a href=\"" + dr["LinkUrl"] + "\" target=\"_blank\"><span style=\"color:red;font-weight:bold\">立即购买</span></a></p>");
            str.Append(" <p class=\"dt_ft\">" + dr["Summary"] + "</p></div>");
            str.Append("<p class=\"img\"><img src=\"images/mall/" + dt_mall.Rows[0]["logo"] + "\" alt=\"" + dt_mall.Rows[0]["Title"] + "\" /></p></div>");
            str.Append(" <div class=\"pic_pro\" id=\"pro"+dr["ID"]+"\">");
            str.Append("<UL>");
            foreach (DataRow dr_img in dt_img.Rows)
            {
                str.Append("<li><a href=\"" + path + dr_img["BigImg"] + "\"><img src=\"" + path + dr_img["smallImg"] + "\"  /></a></li>");
            }
            str.Append("</UL> </div> <div class=\"bm_indtype\"></div></div>");
        }
        this.ltlContent.Text = str.ToString();
        this.ltlHot.Text = CreateHotGoods();
    }
    #endregion
}
